package com.lijj.activiti.entity;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.activiti.engine.impl.el.Expression;

public class ExpressionInjectionDelegate implements JavaDelegate {
	private Expression user;
    private Expression amountResult;
    
	public void setAmountResult(Expression amountResult) {
		this.amountResult = amountResult;
	}

	public void setUser(Expression user) {
		this.user = user;
	}

	public void execute(DelegateExecution execution) throws Exception {
		UserBean userBean = (UserBean) user.getValue(execution);
		System.out.println("在javadelegate中注入对象："+userBean.getName()+":"+userBean.getPasswd());
		System.out.println("使用UserBean的方法计算后结果："+amountResult.getValue(execution));
	}

}
